package apcsif;  
  

/*
 * This class is responsible for parsing all commands entered while playing the game (we need to name the game!)
 */

public class Parser {
    String locat;
    static String param;

    public Parser() {

    }

    public void parse(String input) { // parses the command. Each possible
                                        // command needs to be a separate case
                                        // in the switch
        switch (input) {
        case "north":
        case "n":
            locat = world.getLocat();
            world.changeLocat(locat, "n");
            break;
        case "south":
        case "s":
            locat = world.getLocat();
            world.changeLocat(locat, "s");
            break;
        case "east":
        case "e":
            locat = world.getLocat();
            world.changeLocat(locat, "e");
            break;
        case "west":
        case "w":
            locat = world.getLocat();
            world.changeLocat(locat, "w");
            break;
        case "up":
        case "u":
            locat = world.getLocat();
            world.changeLocat(locat, "u");
            break;
        case "down":
        case "d":
            locat = world.getLocat();
            world.changeLocat(locat, "d");
            break;
        case "exit":
            exit();
            break;
        case "inventory":
        case "inv":
            Globals.getInv();
            break;
        case "hands":
            System.out.println("You are holding a " + Globals.right() + " and a " + Globals.left());
            break;
        case "look":
        case "l":
            locat = world.getLocat();
            world.changeLocat(locat, "l");
            break;
        case "take":
            locat = world.getLocat();
            world.changeLocat(locat, "t");
            break;
        case "help":
        case "h":
            System.out.println("north / n\tGo north");
            System.out.println("south / s\tGo south");
            System.out.println("etc.");
            System.out.println("up / u   \tGo up stairs or ladder");
            System.out.println("down / d \tGo down stairs or ladder");
            System.out.println("look / l \tLooks at the room");
            System.out.println("inv      \tDisplays your inventory");
            System.out.println("hands    \tDisplays whats in your hands");
            System.out.println("take     \tTake the item you specify");
            System.out.println("eqip     \tEquip the item you specify");
            System.out.println("discard  \tDiscard the item you specify");
            System.out.println("attack   \tAttack the person you specify");

    System.out.println("obj / o  \tDisplay objectives");

            System.out.println("exit     \tExit On The Wall (no save data)");
            System.out.println("help / h \tYou already know how to do this");
            break;
        case "drop":
            Globals.dropItem(param());
            break;
        case "attack":
            locat = world.getLocat();
            world.changeLocat(locat, "a");
            break;
        case "equip":
            Globals.equip(param());
            break;
            case "o": case "obj":
    System.out.println("Find Gary in the robotics room");
    System.out.println("Do what he tells you to");
    System.out.println("Get back home");
    break;

            case "param":
            	System.out.println(Parser.param());
            	break;
        default:
            System.out.println("I don't understand");
            break;
        }
    }

    public void exit() {
        System.exit(0);
    }

    public static void setParam(String parameter) {
        param = parameter;
    }

    public static String param() {
        return (param);
    }
}
